import { ElDrawer, ElMessageBox } from "element-plus";
import { h } from "vue";

declare interface dialogOptions {
  component: any;
  props?: any;
  title?: string;
  otherOptions?: any;
}

export function openDialog(options: dialogOptions) {
  debugger;
  //1.解构参数
  const {
    component,
    props: getPropsFunc = () => {
      // TODO: Implement props fetching logic or remove if not needed.
    },
    title = "数据详情",
    otherOptions = {}
  } = options;
  //2.打开弹框
  ElMessageBox({
    customStyle: {
      //默认样式
      width: "60%",
      maxWidth: "100%"
    },
    title: title,
    message: () => {
      return h(component, getPropsFunc(ElMessageBox.close));
    },
    showConfirmButton: false, //不显示确定按钮
    ...otherOptions
  });
}

export function openDrawer(options: any) {
  const { component, props, title, width, otherOptions } = options;
  ElDrawer;
}
